import React, {Component} from "react";
import { Row, Col } from 'antd';
import { withRouter } from 'react-router-dom';

class Head extends Component{

    constructor(props) {
        super(props);
        this.state = {
            detail: {}
        }
    }

    render() {
        const { detail } = this.state;
        return (
            <>
                <Row className="title">
                    <Col span={24}>{detail.curriculumName}</Col>
                </Row>
                <Row className="content">
                    <Col span={8}>授课人：{detail.teacherName}</Col>
                    <Col span={8}>学校名称：{detail.schoolName}</Col>
                    <Col span={8}>授课班级：{detail.className}</Col>
                </Row>
            </>
        )
    }

    componentDidMount() {
        this.axios({
            method: 'get',
            url: '/Curriculum/getCurriculumBase',
            params: {
                curriculumId: this.props.match.params.id || '',
                classCode: this.props.location.state.code || ''
            }
        }).then(res => {
            if(res.success){
                this.setState({
                    detail: res.data
                })
            }
        })
    }
}

export default withRouter(Head)
